package com.sljy.hzk.net.service;

import com.sljy.hzk.entity.MainNoticeNumEntity;
import com.sljy.hzk.entity.TaskCountEntity;
import com.sljy.hzk.entity.UserEntity;
import com.sljy.hzk.net.CommonResult;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

/**
 * Created  on 2018/6/27 0027
 *
 * @author 唐开阔
 * @describe
 */
public interface UserServive {
    @FormUrlEncoded
    @POST("login.do")
    Observable<CommonResult<UserEntity>> userLogin(@Field("username") String username, @Field("password") String password);

    @FormUrlEncoded
    @POST("index.do")
    Observable<CommonResult<MainNoticeNumEntity>> getIndex(@Field("userId") long userId, @Field("cpId") long cpId);

    @FormUrlEncoded
    @POST("updatePassword.do")
    Call<CommonResult<String>> fixPsw(@Field("userId") long uId, @Field("oldPassword") String pOld, @Field("newPassword") String pNew);

    @FormUrlEncoded
    @POST("myTask/getTaskCount.do")
    Observable<CommonResult<TaskCountEntity>> getTaskCountDate(@Field("cpId") long cpId, @Field("pId") long pId, @Field("date") String date);

    /**
     * 上传图片
     */
    @Multipart
    @POST("uploadHeadPic.do")
    Call<CommonResult<String>> upHeadPicGetUrl(@Part() MultipartBody.Part part);

    @FormUrlEncoded
    @POST("updateUserHead.do")
    Call<CommonResult<String>> upHeadPicSave( @Field("userId")long userId,@Field("headPic")String headPic);
}
